package org.ecpkn.PAGridSim.FUPAOptimization;

import java.util.ArrayList;

import org.ecpkn.PAGridSim.core.offlineOptimization.ChangingWorkloadOptimizationAlgo;
import org.ecpkn.PAGridSim.core.offlineOptimization.OptimizedResultEntry;
import org.ecpkn.PAGridSim.core.tasksCreation.Task;

public class FUPAChangingWorkloadOptimization extends
		ChangingWorkloadOptimizationAlgo {

	public FUPAChangingWorkloadOptimization(ArrayList<Task> tasks) {
		super(tasks);
	}

	@Override
	protected double singleTaskLoad(Task t) throws Exception {
		// 计算某个任务的单独负载,Instruction/Second
		double load = (double) (t.getLength_() / 1000 / t.getPeriod_());
		return load;
	}

	@Override
	protected OptimizedResultEntry singleWorkloadOptimization(double workload) {
		//TODO:may be generalisted?
		return new FUPAOptimization(workload).optimize();
	}
}
